/*
day142_3
2020.1.17
*/

#include<iostream>
#include<unordered_map>
#include<vector>
#include<string>
using namespace std; 


class Solution 
{
public:
    vector<string> findRestaurant(vector<string>& list1, vector<string>& list2) 
	{
		vector<string> res;
        unordered_map<string,int> m;
        for(int i=0;i<list1.size();i++)	m[list1[i]]=i+1; 
        
        int sum=INT_MAX;
        for(int i=0;i<list2.size();i++)
        {
        	int index=m[list2[i]];
        	if(index)	
			{
				if(i+1+index==sum)
				{
					res.push_back(list2[i]);
				}
				else if(i+1+index<sum)
				{
					res.clear();
					sum=i+1+index;
					res.push_back(list2[i]);
				} 
			}
		}
		
		return res;
    }
    
};



int main()
{
	return 0;
}
